#include<iostream>

#include<map>
#include<vector>

using namespace std;

#include"AVLTree.h"

int main()
{
	//int a[] = { 16,3,7,11,9,26,18,14,15 };
	int a[] = { 4,2,6,1,3,5,15,7,16,14 };
	AVLTree<int, int> t;
	for (auto e : a)
	{
		t.Insert(make_pair(e, e));
	}

	t.InOrder();
	cout << t.IsBalance() << endl;

	return 0;
}

int main()
{
	const int N = 100000;
	vector<int> v;
	v.reserve(N);
	//srand(time(0));
	for (size_t i = 0; i < N; i++)
	{
		v.push_back(rand());
	}
	AVLTree<int, int> t;
	for (auto e : v)
	{
		/*if (e == 11478)
		{
			int x = 0;
		}*/
		t.Insert(make_pair(e, e));
		//cout << "Insert:" << t.IsBalance() << endl;
	}

	//t.InOrder();
	cout << t.IsBalance() << endl;
	cout << t.Height() << endl;
	cout << t.Size() << endl;

	size_t begin1 = clock();
	for (auto e : v)
	{
		t.Find(e);
	}
	size_t end1 = clock();

	cout << "Find:" << end1 - begin1 << endl;

	return 0;
}

int main()
{
	int a[] = { 16, 3, 7, 11, 9, 26, 18, 14, 15 };
	AVLTree<int, int> t;

	for (auto e : a)
	{
		t.Insert(make_pair(e, e));
	}
	t.InOrder();

	return 0;
}